<template>
<div>
  <MyHeader title="Tabbar购物车案例" background="blue" color="white"></MyHeader>


 <div class="main">

   <component :is="componentName" ></component>
 </div>
  <MyTabBar :arr="tabList" @ss="changeName"></MyTabBar>
</div>
</template>

<script>


import MyHeader from "@/components/MyHeader.vue";
import MyTabBar from "@/components/MyTabBar.vue";
import MyGoodsSearch from "@/components/MyGoodsSearch.vue";
import MyUserInfo from "@/components/MyUserInfo.vue";
import MyGoodsList from "@/components/MyGoodsList.vue";

export default {
  name: 'App',
  components: {
    MyGoodsList,
    MyUserInfo,
    MyGoodsSearch,
    MyTabBar,
    MyHeader,


  },
  methods:{
    changeName(index){

      this.componentName=this.tabList[index].componentName
      console.log(index,"    ",this.tabList[index].componentName)
    }
  },
  data(){
    return{
      componentName:"MyGoodsList",
      tabList: [
        {
          iconText: "icon-shangpinliebiao",
          text: "商品列表",
          componentName: "MyGoodsList"
        },
        {
          iconText: "icon-sousuo",
          text: "商品搜索",
          componentName: "MyGoodsSearch"
        },
        {
          iconText: "icon-user",
          text: "我的信息",
          componentName: "MyUserInfo"
        }
      ]
    }
  }
}
</script>

<style>
.main{
  padding-top:45px ;
}
</style>
